package tinf.ispis;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Detaljan ispis procesa slanja, kodiranja, dekodiranja i primanja poruka u
 * datoteku "ispis.txt".
 * 
 * @author Dado
 */
public class IspisUDatoteku {

	private static File datoteka;
	private static BufferedWriter pisac;

	static {
		datoteka = new File("ispis.txt");
		try {
			pisac = new BufferedWriter(new FileWriter(datoteka));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void upisiUDatoteku(String line) {
		try {
			pisac.write(line);
			pisac.newLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void zatvoriPisac() {
		try {
			pisac.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
